package nc.bs.pub.action;

import nc.bs.common.projectFAUtils;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.itf.pu.m23.approve.IArriveApprove;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pub.power.PowerActionEnum;
import nc.vo.scmpub.res.billtype.POBillType;
import nc.vo.uap.pf.PFBusinessException;
import nccloud.vo.scmpub.utils.power.DataPermissionUtil;

public class N_23_UNSAVEBILL extends AbstractCompiler2 {
	public String getCodeRemark() {
		return "\tObject retValue = null;\n      \n      nc.vo.pu.m23.entity.ArriveVO[] inObject = (nc.vo.pu.m23.entity.ArriveVO[]) getVos();\n      retValue = nc.bs.framework.common.NCLocator.getInstance().lookup(nc.itf.pu.m23.approve.IArriveApprove.class)\n          .unSendArrive(inObject, this);\n      \n      return retValue;\n";
	}

	public Object runComClass(PfParameterVO vo) throws BusinessException {
		try {
			super.m_tmpVo = vo;
			Object retValue = null;
			ArriveVO[] inObject = (ArriveVO[]) ((ArriveVO[]) this.getVos());
			if (vo.isCloudEntry) {
				DataPermissionUtil.checkPermission(inObject, POBillType.Arrive.getCode(),
						PowerActionEnum.UNCOMMIT.getActioncode(), "vbillcode");
			}

			//lhw 231128 保存前校验项目 begin
			new projectFAUtils().projectDataApprove("po_arriveorder", inObject, "unsave");
			//end
			
			retValue = ((IArriveApprove) NCLocator.getInstance().lookup(IArriveApprove.class)).unSendArrive(inObject,
					this);
			return retValue;
		} catch (Exception var4) {
			if (var4 instanceof BusinessException) {
				throw (BusinessException) var4;
			} else {
				throw new PFBusinessException(var4.getMessage(), var4);
			}
		}
	}
}